#ifndef __TLIST_H__
#define __TLIST_H__

#include "tlib.h"

#define STACK_TYPE int

typedef struct STACK_NODE{
	STACK_TYPE value;
	struct STACK_NODE *stack_next;
}StackNode;

static StackNode*	stack;

#define tostacktype(l)   (cast(StackNode *, cast(t_byte *, l) ))

void create_stack(size_t size){
}

int is_empty( void ){
	return stack == NULL;
}

int is_full( void ){
	return false;
}

void push_lstack(STACK_TYPE value){
	StackNode* new_node ;
	new_node = tostacktype(T_MALLOC( NULL , 1 , StackNode ));
	assert( new_node != NULL ) ;
	new_node->value = value ;
	new_node->stack_next = stack ;
	stack = new_node;
	new_node=NULL;
}

int pop_lstack( void ){
	StackNode* first_node ;
	int tvalue = 0;
	assert( ! is_empty() ) ;
	first_node = stack->stack_next ;
	tvalue = stack->value;
	assert( T_MALLOC( stack , 0 , 0) == NULL) ;
	stack = first_node;
	return tvalue;
}

STACK_TYPE top_lstack( void ){
	assert( ! is_empty() ) ;
	return stack->value ;
}

void destory_lstack( void ){
	while(! is_empty()){
		pop_lstack();
	}
}



#endif
